class Watch {
  String? id;
  String? imei;
  String? staffCode;
  String? staffName;
  String? watchCode;
  String? watchName;
  int? watchType;
  double? lat;
  double? lng;
  int? state;
  String? stateName;
  String? icon;
  List<WatchBaseData>? baseData;
  DateTime? portalOWAt;
  String? address;
  String? phone;

  Watch(
      {this.id,
      this.imei,
      this.staffCode,
      this.staffName,
      this.watchCode,
      this.watchName,
      this.watchType,
      this.lat,
      this.lng,
      this.state,
      this.stateName,
      this.icon,
      this.baseData,
      this.portalOWAt,
      this.address,
      this.phone});

  Watch.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    imei = json['imei'];
    staffCode = json['staffCode'];
    staffName = json['staffName'];
    watchCode = json['watchCode'];
    watchName = json['watchName'];
    watchType = json['watchType'];
    lat = json['lat'];
    lng = json['lng'];
    state = json['state'];
    stateName = json['stateName'];
    icon = json['icon'];
    if (json['baseData'] != null) {
      baseData = <WatchBaseData>[];
      json['baseData'].forEach((v) {
        baseData!.add(new WatchBaseData.fromJson(v));
      });
    }
    portalOWAt =
    json['portalOWAt'] != null ? DateTime.tryParse(json['portalOWAt']) : null;
    address = json['address'];
    phone = json['phone'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['imei'] = this.imei;
    data['staffCode'] = this.staffCode;
    data['staffName'] = this.staffName;
    data['watchCode'] = this.watchCode;
    data['watchName'] = this.watchName;
    data['watchType'] = this.watchType;
    data['lat'] = this.lat;
    data['lng'] = this.lng;
    data['state'] = this.state;
    data['stateName'] = this.stateName;
    data['icon'] = this.icon;
    if (this.baseData != null) {
      data['baseData'] = this.baseData!.map((v) => v.toJson()).toList();
    }
    data['portalOWAt'] = this.portalOWAt;
    data['address'] = this.address;
    data['phone'] = this.phone;
    return data;
  }
}

class WatchBaseData {
  String? code;
  String? name;
  String? val;
  bool? alert;
  String? alertName;

  WatchBaseData({this.code, this.name, this.val, this.alert, this.alertName});

  WatchBaseData.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    name = json['name'];
    val = json['val'];
    alert = json['alert'];
    alertName = json['alertName'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['name'] = this.name;
    data['val'] = this.val;
    data['alert'] = this.alert;
    data['alertName'] = this.alertName;
    return data;
  }
}
